package fi.softala.multiplikation;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.Menu;
import android.widget.TextView;
import android.widget.Toast;

public class HighScoresActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_high_scores);

		TextView tvScore1 = (TextView) findViewById(R.id.tvEkaScore);
		SharedPreferences tulokset = Storage.gamestorage;
		if(tulokset == null) {
			tulokset = getPreferences(MODE_PRIVATE);
		}
		String score = tulokset.getString("score1", null);
		tvScore1.setText(score);

		TextView tvScore2 = (TextView) findViewById(R.id.tvTokaScore);
		score = tulokset.getString("score2", null);
		tvScore2.setText(score);

		TextView tvScore3 = (TextView) findViewById(R.id.tvKolmasScore);
		score = tulokset.getString("score3", null);
		tvScore3.setText(score);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.high_scores, menu);
		return true;
	}

	public void showToast(String toastText) {
		Context context = getApplicationContext();
		int duration = Toast.LENGTH_LONG;
		Toast toast = Toast.makeText(context, toastText, duration);
		toast.show();
	}

}
